<template>
  <div class="Sige">
    <div class="title">
      个人简介
    </div>
    <div class="content">
      这个人很懒,什么都没有留下...
    </div>

    <div class="title">
      <span>
        我的动态
      </span>

      <span class="issus" @click="goDy">
        <i class="iconfont icon-bianji"></i> 发动态
      </span>
    </div>
    <div class="Mytext-sige" v-for="item in datastory" @click="goDetail(item)">
      <div class="Mytext-sige-title">
        <div class="Mytext-sige-title-time">{{ item.s_created_time }}</div>
        <div class="Mytext-sige-title-font">{{ item.s_title }}</div>
      </div>
      <div class="Mytext-sige-title-main">{{ item.s_main }}</div>
    </div>
    <div class="content" v-if="isText">
      <div class="noting">
        <div class="noting-bg">
          <img
            src="https://s.moimg.net/img/web4-0/confirm_for_placeholder@2x.png"
            alt=""
          />
        </div>
        <p>
          暂时还没有发布的动态
        </p>
      </div>
    </div>
    <div class="page_box_goodsMange">
      <template>
        <Page
          :total="dataCount"
          :page-size="pageSize"
          show-total
          class="paging"
          @on-change="changepage"
        />
      </template>
    </div>
  </div>
</template>

<script>
import { getMyDymessage } from "server/commuity.js";

export default {
  data() {
    return {
      isText: false,
      // 初始化信息总条数
      dataCount: 0,
      // 每页显示多少条
      pageSize: 2,
      datastory: [],
      allData: [],
    };
  },
  methods: {
    goDy() {
      this.$router.push({
        path: "/front/Dynamic",
      });
    },
    goDetail(msg) {
   
      this.$router.push({
        path: "/front/Details",
        query: {
          storId: msg.s_id,
        },
      });
    },
    changepage(index) {
      var _start = (index - 1) * this.pageSize;
      var _end = index * this.pageSize;
      this.datastory = this.allData.slice(_start, _end);
    },
    changepagenew(sendsdata) {
      this.datastory = [];
      this.allData = [];
      this.allData = sendsdata;
      this.dataCount = sendsdata.length;
      if (sendsdata.length < this.pageSize) {
        this.datastory = this.allData;
      } else {
        this.datastory = this.allData.slice(0, this.pageSize);
      }
    },
  },
  created() {
    let _this = this;
    let token = window.localStorage.getItem("front_token");
    getMyDymessage(token).then(function(res) {
      if (res.err_code == 1001) {
        _this.isText = true;
      } else {
        _this.changepagenew(res.data);
      }
    });
  },
};
</script>

<style scoped>
.Sige {
  margin-top: 20px;
}
.title {
  font-size: 20px;
  font-weight: 600;
  color: #000;
  border-bottom: 1px solid rgb(222, 224, 225);
  padding: 20px 0;
}
.content {
  padding: 20px 0;
}
.issus {
  color: #4281cd;
  float: right;
  font-size: 14px;
  margin-right: 20px;
  font-weight: 500;
  cursor: pointer;
}
.noting {
  text-align: center;
}
.noting img {
  height: 100px;
  width: 100px;
  margin-bottom: 30px;
}
.Mytext-sige {
  width: 100%;
  height: 100px;
  /* border: 1px solid black; */
  padding: 11px;
  border-bottom: 1px solid #eee;
}
.Mytext-sige-title {
  height: 50px;
}
.Mytext-sige-title-time {
  height: 20px;
  font-size: 13px;
}
.Mytext-sige-title-font {
  font-size: 16px;
  padding: 3px;
  color: black;
  /* padding-top: 2px; */
  font-weight: 700;
}
.Mytext-sige-title-main {
  font-size: 12px;
  padding-left: 3px;
}
.page_box_goodsMange {
  float: right;
}
</style>
